package pl.enigmatic.util;

import java.awt.event.KeyEvent;


public class Keyboard {
	private Keyboard() {}

	public static boolean isLatinCode(final int code) {
		return code >= KeyEvent.VK_A && code <= KeyEvent.VK_Z;
	}

	public static boolean isLatin(final char c) {
		switch (Character.toUpperCase(c)) {
			case 'A':
			case 'B':
			case 'C':
			case 'D':
			case 'E':
			case 'F':
			case 'G':
			case 'H':
			case 'I':
			case 'J':
			case 'K':
			case 'L':
			case 'M':
			case 'N':
			case 'O':
			case 'P':
			case 'Q':
			case 'R':
			case 'S':
			case 'T':
			case 'U':
			case 'V':
			case 'W':
			case 'X':
			case 'Y':
			case 'Z':
				return true;
		}
		return false;
	}

	public static boolean isLatin(final KeyEvent event) {
		if (isLatinCode(event.getKeyCode())) { return isLatin(event.getKeyChar()); }
		return false;
	}
}
